package com.jiuan.transfer.rabbitmq;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.Consumer;
import com.rabbitmq.client.ExceptionHandler;
import com.rabbitmq.client.TopologyRecoveryException;
import com.rabbitmq.client.impl.DefaultExceptionHandler;

/**
 * @Title: MyRabbitExceptionHandler.java
 * @Package com.jiuan.transfer.rabbitmq
 * @Description: TODO
 * @author liqinglin
 * @date 2016年9月6日 下午4:49:10
 * @version V1.0
 */

public class MyRabbitExceptionHandler implements ExceptionHandler {

    @Override
    public void handleUnexpectedConnectionDriverException(Connection conn,
                                                          Throwable exception) {
        System.out.println(conn);
        exception.printStackTrace();
    }
    /*	amqp://admin@192.168.12.111:5672/
            java.net.SocketException: Software caused connection abort: recv failed
    */
    @Override
    public void handleReturnListenerException(Channel channel,
                                              Throwable exception) {
    }

    @Override
    public void handleFlowListenerException(Channel channel, Throwable exception) {
    }

    @Override
    public void handleConfirmListenerException(Channel channel,
                                               Throwable exception) {
    }

    @Override
    public void handleBlockedListenerException(Connection connection,
                                               Throwable exception) {
    }

    @Override
    public void handleConsumerException(Channel channel, Throwable exception,
                                        Consumer consumer, String consumerTag, String methodName) {
    }

    @Override
    public void handleConnectionRecoveryException(Connection conn,
                                                  Throwable exception) {
    }

    @Override
    public void handleChannelRecoveryException(Channel ch, Throwable exception) {
    }

    @Override
    public void handleTopologyRecoveryException(Connection conn, Channel ch,
                                                TopologyRecoveryException exception) {
    }

}
